package org.example.hospital_frontend.controller;

import org.example.hospital_frontend.common.Result;
import org.example.hospital_frontend.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/admin/statistics")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;

    @GetMapping("/basic")
    public Result<Map<String, Object>> getBasicStatistics() {
        return Result.success(statisticsService.getBasicStatistics());
    }

    @GetMapping("/register-trend")
    public Result<Map<String, Object>> getRegisterTrend() {
        return Result.success(statisticsService.getRegisterTrend());
    }

    @GetMapping("/doctor-stats")
    public Result<Map<String, Object>> getDoctorStatistics() {
        return Result.success(statisticsService.getDoctorStatistics());
    }

    @GetMapping("/diagnosis-distribution")
    public Result<Map<String, Object>> getDiagnosisDistribution() {
        return Result.success(statisticsService.getDiagnosisDistribution());
    }

    @GetMapping("/age-distribution")
    public Result<Map<String, Object>> getAgeDistribution() {
        return Result.success(statisticsService.getAgeDistribution());
    }
} 